﻿using System;

namespace ShopB2C.Parameters {

    // 分类 - 父分类 ID - 分类页码 - 分类 ID - 特性 ID - 
    // 特性页码 - 特性值 ID - 特性值页码 - 自动排序号 - ID 集
    // Product-0-1-67-0-1-11-1-2-11,22,33
    [Serializable]
    public class ClassifyParam {
        public ClassifyParam() { }
        /// <summary>
        /// 分类
        /// </summary>
        public string ModuleKey { get; set; }
        /// <summary>
        /// 父分类 ID
        /// </summary>
        public int ParentClassifyId { get; set; }
        /// <summary>
        /// 分类页码
        /// </summary>
        public int ClassifyPageNumber { get; set; }
        /// <summary>
        /// 分类 ID
        /// </summary>
        public int ClassifyId { get; set; }
        /// <summary>
        /// 特性 ID
        /// </summary>
        public int PropertyId { get; set; }
        /// <summary>
        /// 特性页码
        /// </summary>
        public int PropertyPageNumber { get; set; }
        /// <summary>
        /// 特性值 ID
        /// </summary>
        public int PropertyValId { get; set; }
        /// <summary>
        /// 特性值页码
        /// </summary>
        public int PropertyValPageNumber { get; set; }
        /// <summary>
        /// 自动排序号
        /// </summary>
        public int AutoSequence { get; set; }
        /// <summary>
        /// 删除的 ID 集
        /// </summary>
        public string DeleteIds { get; set; }
        /// <summary>
        /// 参选还原成字符串
        /// </summary>
        /// <returns>string</returns>
        public override string ToString() {
            return string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}-{9}",
                this.ModuleKey,
                this.ParentClassifyId,
                this.ClassifyPageNumber <= 0 ? 1 : this.ClassifyPageNumber,
                this.ClassifyId,
                this.PropertyId,
                this.PropertyPageNumber <= 0 ? 1 : this.PropertyPageNumber,
                this.PropertyValId,
                this.PropertyValPageNumber <= 0 ? 1 : this.PropertyValPageNumber,
                this.AutoSequence <= 0 ? 1 : this.AutoSequence,
                string.IsNullOrEmpty(this.DeleteIds) ? "0" : this.DeleteIds);
        }
    }
}
